package com.fhz.day004.model

import com.fhz.day004.FoodApi
import com.fhz.day004.contract.FoodContract
import com.fhz.day004.entity.Food
import com.fhz.day004.utils.RetrofitManager
import io.reactivex.Observer
import io.reactivex.Scheduler
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * 时间:2021/10/15
 * @author msfeng
 * 简述: TODO
 */
class FoodModel : FoodContract.IFoodModel{

    override fun getData(observer: Observer<Food>) {
        //网络请求
        RetrofitManager.create(FoodApi::class.java).getFood()
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(observer)
    }

    override fun destroy() {

    }
}